<template>
  <div class="menu nodrag">
    <div class="menulogo"></div>
    <div class="list">
      <div class="title">筛查</div>
      <div class="path">
        <div class="pathlist" :class="menuindex == 1 ? 'pathslect' : ''">
          <div @click="skipurl('/confidentialdocuments', 1)" class="name">
            保密文件
          </div>
          <div v-if="menuindex == 1" class="bg"></div>
        </div>
        <div class="pathlist">
          <div class="name">软件安全</div>
        </div>
      </div>
    </div>
    <div class="list">
      <div class="title">查询</div>
      <div class="path">
        <div class="pathlist" :class="menuindex == 2 ? 'pathslect' : ''">
          <div @click="skipurl('/clouddesktop', 2)" class="name">云桌面</div>
          <div v-if="menuindex == 2" class="bg"></div>
        </div>
      </div>
    </div>
    <div class="list">
      <div class="title">传输</div>
      <div class="path">
        <div class="pathlist" :class="menuindex == 3 ? 'pathslect' : ''">
          <div @click="skipurl('/encryptfiles', 3)" class="name">文件加密</div>
          <div v-if="menuindex == 3" class="bg"></div>
        </div>
        <div class="pathlist" :class="menuindex == 4 ? 'pathslect' : ''">
          <div @click="skipurl('/filedecryption', 4)" class="name">
            文件解密
          </div>
          <div v-if="menuindex == 4" class="bg"></div>
        </div>
        <div class="pathlist"><div class="name">站内传输</div></div>
      </div>
    </div>
    <div class="list">
      <div class="title">系统</div>
      <div class="path">
        <div class="pathlist">
          <div class="name" @click="handleLogout">账号管理</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: {
    menuindex: {
      type: Number, // 或者其他你期望的类型，如 String、Boolean 等
      default: 1, // 默认值，如果父组件没有传递这个值
      required: false, // 如果这个 prop 是必须的，设置为 true
    },
  },
  methods: {
    skipurl(url, index) {
      this.$router.push({ path: url });
      localStorage.setItem("menuindex", index);
      this.$emit("menuindex", index);
    },
    handleLogout() {
      window.location.href = "../login.html";
    },
  },
};
</script>

<style lang="less" scoped>
.menu {
  width: 220px;
  height: 720px;
  background-size: cover;
  overflow: hidden;
  background-image: url(@/assets/img/menuleft.png);
  position: relative;
  .menulogo {
    width: 200px;
    height: 100px;
    background-image: url(@/assets/img/menulogo.png);
    background-size: cover;
  }
  .list {
    color: #ffffff;
    margin-top: 43px;
    .title {
      width: 32px;
      height: 16px;
      font-family: MicrosoftYaHeiLight;
      font-size: 16px;
      color: #ffffff;
      line-height: 16px;
      text-align: left;
      font-style: normal;
      margin-bottom: 24px;
      margin-left: 40px;
    }
    .path {
      position: relative;
      .patlist {
        position: relative;
      }
      .name {
        margin-left: 88px;
        width: 80px;
        height: 32px;
        font-family: MicrosoftYaHeiLight;
        font-size: 20px;
        color: #ffffff;
        line-height: 32px;
        text-align: left;
        font-style: normal;
        cursor: pointer;
      }
      .bg {
        position: absolute;
        right: 0;
        top: 4px;
        width: 8px;
        height: 20px;
        background: #ffffff;
        border-radius: 4px;
        z-index: 20;
      }
      .pathslect {
        width: 220px;
        height: 32px;
        background: linear-gradient(
          270deg,
          rgba(0, 0, 0, 0) 0%,
          rgba(0, 0, 0, 0.1) 100%
        );
        display: flex;
      }
    }
  }
}
</style>